/**
 * @param {number[]} height
 * @return {number}
 */
var maxArea = function (height) {
    // 数组长度
    var len = height.length;
    var left = 0, right = len - 1;
    var ans = 0;
    while (left < right) {
        ans = Math.max(ans, (right - left) * Math.min(height[left], height[right]));
        // 判断两边指针的移动 肯定希望高的那一边不动 为了保持体积最大
        if (height[left] > height[right]) {
            right--;
        } else {
            left++;
        }
    }
    return ans;
};
console.log(maxArea([1, 8, 6, 2, 5, 4, 8, 3, 7]))